package General;
import java.util.LinkedList;


public class Unit {
	//battle units
	private final int MAX= 8;
	private Resource buildCost;
	private int[] bonus= new int [MAX];
	private int diceRolls;
	private LinkedList<UnitsEnum> type;
	String name;
	//Special attributes

	public Unit(String n, int rolls, Resource cost, UnitsEnum unitType1, UnitsEnum unitType2, UnitsEnum unitType3, int bonusIndexNumber1, int bonusAttribute1, int bonusIndexNumber2, int bonusAttribute2)
	{
		type= new LinkedList<UnitsEnum>();
		name= n;
		diceRolls= rolls;
		buildCost= cost;
		if (unitType1 != null)
			type.add(unitType1);
		else
			poop();
		
		if(unitType2 != null)
			type.add(unitType2);
		else
			poop();
		
		if(unitType3 != null )
			type.add(unitType3);
		else
			poop();
		
		if (bonusIndexNumber1 != -1)
			bonus [bonusIndexNumber1]= bonusAttribute1;
		else
			poop();
		
		if (bonusIndexNumber2 != -1)
			bonus [bonusIndexNumber2]= bonusAttribute2;
		else
			poop();
	}//end constructor

	public static Unit[] getUnit(int culture){
		switch(culture){
		case 0:
			//set up Norse Units
			Unit[]norseUnits= new Unit [11];
			norseUnits [0]= new Unit ("Jarl", 3, new Resource(1,0,0,1), UnitsEnum.MORTAL, UnitsEnum.CAVALRY, null, 4, 4, 1, 4);
			norseUnits [1]= new Unit ("Troll", 6, new Resource (3,2,0,0), UnitsEnum.MYTH, UnitsEnum.WARRIOR, null,  2, 4, -1, 0);
			norseUnits [2]= new Unit ("Throwing Axeman", 3, new Resource(1,0,0,1), UnitsEnum.MORTAL, UnitsEnum.ARCHER, null, 7, 3, 6, 4);
			norseUnits [3]= new Unit ("Dwarf", 4, new Resource(2,0,0,2), UnitsEnum.MYTH, UnitsEnum.GIANT_KILLER, null, 3, 7, -1, 0);
			norseUnits [4]= new Unit ("Huskarl", 7, new Resource (1,0,0,2), UnitsEnum.MORTAL, UnitsEnum.WARRIOR, null, 2, 4, -1, 0);
			norseUnits [5]= new Unit ("Classical Norse Hero", 5, new Resource(3,0,0,3), UnitsEnum.HERO,null, null, 0, 4, -1, 0);
			norseUnits [6]= new Unit ("Nidhogg", 7, new Resource(0,0,1,4), UnitsEnum.MYTH, UnitsEnum.FLYER, null, 8, 4, -1, 0);
			norseUnits [7]= new Unit ("Heroic Norse Hero", 6, new Resource(3,0,0,3), UnitsEnum.HERO, null, null, 0, 4, -1, 0);
			norseUnits [8]= new Unit ("Valkyrie", 5, new Resource (0,0,3,1), UnitsEnum.MYTH, UnitsEnum.CAVALRY, null, 1, 4, -1, 0);
			norseUnits [9]= new Unit ("Mythic Norse Hero", 8, new Resource (4, 0, 4, 0), UnitsEnum.HERO, null, null, 0, 4, -1, 0);
			norseUnits [10]=new Unit ("Frost Giant", 7, new Resource (4, 0, 2, 0), UnitsEnum.WARRIOR, null, UnitsEnum.MORTAL, 7, 2, 5, 3);
			return norseUnits;
		
		case 1:
			//set up Egyptian Units
			Unit[] egyptianUnits= new Unit[11];
			egyptianUnits [0]= new Unit ("Chariot Archer", 3, new Resource (0,1,0,1), UnitsEnum.MORTAL, UnitsEnum.ARCHER, UnitsEnum.CAVALRY, 6, 3, 7, 3 );
			egyptianUnits [1]= new Unit ("Phoenix", 6, new Resource(0,2,3,0), UnitsEnum.MYTH, UnitsEnum.FLYER, null, 8, 4, -1, 0);
			egyptianUnits [2]= new Unit ("Spearman", 3, new Resource(1,1,0,0), UnitsEnum.MORTAL, UnitsEnum.WARRIOR, null, 2, 3, 4, 4);
			egyptianUnits [3]= new Unit ("Wadjet", 5, new Resource (2,0,2,0), UnitsEnum.MYTH, UnitsEnum.WARRIOR, null, 2, 4, -1, 0);
			egyptianUnits [4]= new Unit ("Elephant", 3, new Resource (2,0,0,1), UnitsEnum.MORTAL, UnitsEnum.GIANT, null, 5, 2, -1, 0);
			egyptianUnits [5]= new Unit ("Anubite", 5, new Resource (0,0,1,3), UnitsEnum.MYTH, UnitsEnum.CAVALRY, null, 1, 4, -1, 0);
			egyptianUnits [6]= new Unit ("Mummy", 5, new Resource (0,0,2,3), UnitsEnum.MYTH, null, null, -1, 0, -1, 0);
			egyptianUnits [7]= new Unit ("Priest", 4, new Resource (2,0,0,4), UnitsEnum.HERO, null, null, 0, 5, -1, 0);
			egyptianUnits [8]= new Unit ("Scorpion-Man", 5, new Resource (4,0,0,2), UnitsEnum.MYTH, UnitsEnum.GIANT, null, 5, 4, -1, 0);
			egyptianUnits [9]= new Unit ("Pharaoh", 6, new Resource (3,0,0,3), UnitsEnum.HERO, null, null, 0, 4, -1, 0);
			egyptianUnits [10]= new Unit ("Sphinx", 5, new Resource (0,0,2,2), UnitsEnum.MYTH, UnitsEnum.GIANT_KILLER, null, 3, 6, -1, 0);
			egyptianUnits [11]= new Unit ("Son Of Osiris", 8,  new Resource (0,0,4,4), UnitsEnum.HERO, null, null, 0, 4, -1, 0 );
			return egyptianUnits;
		
		case 2:
			//set up Greek Units
			Unit[] greekUnits= new Unit [11];
			greekUnits [0]= new Unit ("Hoplite", 3, new Resource(1,1,0,0), UnitsEnum.WARRIOR, UnitsEnum.MORTAL, null, 2, 3, 5, 1);
			greekUnits [1]= new Unit ("Manticore", 5, new Resource (2,0,2,0), UnitsEnum.MYTH, UnitsEnum.FLYER, null, 8, 4, -1, 0);
			greekUnits [2]= new Unit ("Hippokon", 3, new Resource (1,0,0,1), UnitsEnum.MORTAL, UnitsEnum.CAVALRY, null, 4, 4, 1, 4);
			greekUnits [3]= new Unit ("Centaur", 5, new Resource (0,3,1,0), UnitsEnum.MYTH, UnitsEnum.ARCHER, UnitsEnum.CAVALRY, 1, 3, 6, 3);
			greekUnits [4]= new Unit ("Toxotes", 3,  new Resource (1,1,0,0), UnitsEnum.MORTAL, UnitsEnum.ARCHER, null, 6, 4, 7, 3 );
			greekUnits [5]= new Unit ("Medusa", 5, new Resource (1,0,3,0), UnitsEnum.MYTH, UnitsEnum.GIANT_KILLER, null, 3, 6, -1, 0);
			greekUnits [6]= new Unit ("Hydra", 6, new Resource (0,0,2,2), UnitsEnum.MYTH, UnitsEnum.GIANT, null, 7, 4, -1, 0);
			greekUnits [7]= new Unit ("Classical Greek Hero", 5, new Resource (3,0,0,3), UnitsEnum.HERO, null, null, 0, 4, -1, 0);
			greekUnits [8]= new Unit ("Cyclops", 6, new Resource (3,0,3,0), UnitsEnum.MYTH, UnitsEnum.GIANT, null, 5, 4, -1, 0);
			greekUnits [9]= new Unit ("Heroic Greek Hero", 6, new Resource (3,0,0,4), UnitsEnum.HERO, null, null, 0, 4, -1, 0);
			greekUnits [10]= new Unit ("Minotaur", 5, new Resource (2,2,0,0), UnitsEnum.MYTH, UnitsEnum.WARRIOR, null, 2, 4, -1, 0);
			greekUnits [11]= new Unit ("Mythical Greek Hero", 5, new Resource (0,0,4,4), UnitsEnum.HERO, null, null, -1, 0, -1, 0);
			return greekUnits;
			
			default:
				throw new IllegalArgumentException("Ain't no finna culture");
		}
	}

	public void poop()
	{
		System.out.println ("stephen can suck it");
	}

}//end class